<!DOCTYPE html>
<html>
	<head>
		<script src="/socket.io/socket.io.js"></script>
		<script>
			window.onload = function () {
			  
			  // 소켓을 생성합니다.
			   var socket = io.connect();
			       socket.on('news', function (data) {
            		console.log(data);
            		alert(data);
            		//socket.emit('my other event', {my : 'data'});
       			});
       			
       			document.getElementById('button').onclick = function () {
			  	var text = document.getElementById('text').value;
			  	
			  	socket.emit('my other event',text);
			  };
			};
		</script>
		<body>
			<input type="text" id = "text" />
			<input type="button" id="button" value="echo" />
			
		</body>
	</head>
	
</html>